﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/CaseManagement.Master"
    CodeBehind="Default.aspx.cs" Inherits="FantastPlatform.Community.UI.Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .lableCss
        {
            margin-top: 50px;
            color: #FF0000;
            text-decoration: underline;
            font-weight: bold;
            cursor: hand;
            font-size: 16px;
        }
    </style>
    <script src="JS/Common.js" type="text/javascript"></script>
    <script src="JS/community/PapeToolBar.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/AutoComplateComboBox.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/AreaStreetGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/BaseInfoSearchPanel.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/BaseSearchFrom.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/NoticeGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/NoticeForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/CaseGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/BaseInfoSearchPanel.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/SearchField.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/ResponsibilityAreaStreetGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/WorkLogGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/ReplyForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/ResponsibilityAreaStreetForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/MailListTypeForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/MailListTypeGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/MailListForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/MailListGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/MailListSearchForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/SendMessageForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/WorkLogForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/DateTimeField.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/WorkLogSearchForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/WorkReplyPanel.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/LogReplyGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/RegulationsForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/RegulationsGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/PoliceStreetForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/BusinessGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/BusinessForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/AddPersonForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/PlaceTypeGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/PlaceTypeForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/HouseDistrictGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/HouseDistrictForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/AddPersonField.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/PurposeForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/PurposeGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/BusinessPanel.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/AddPersonGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/HousePersonAddGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/HousePersonAddForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/HousePersonAddPanel.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/AddCarGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/SearchForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/PersonSearchGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/PersonCheckForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/PersonSearchForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/PersonStatesGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/PersonStatesForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/PersonRelationshipGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/PersonRelationshipForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/CarSearchForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/CarSearchGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/CarCheckForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/PersonTypeForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/PersonTypeGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/CarDetails.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/CaseCallBack.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/PhotoField.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/PersonRoleForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/RoleForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/RoleGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/UserRoleGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/PersonDetailsForm.js" type="text/javascript"></script>
    <script type="text/javascript" src="JS/FantastPlatform/HandBookForm.js"></script>
    <script src="JS/FantastPlatform/HandBookGrid.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/AddImageForm.js" type="text/javascript"></script>
    <script src="JS/FantastPlatform/AddImageGrid.js" type="text/javascript"></script>
    <script type="text/javascript">
        function countNav(name) {
            var id = "";
            var url = "";
            switch (name) {
                case "刑事案件":
                    id = "3.1";
                    url = "/Message/CaseGrid.aspx?CaseType=securityCase";
                    break;
                case "治安案件":
                    id = "3.2";
                    url = "/Message/CriminalCaseGrid.aspx?CaseType=criminalCase";
                    break;
                case "提示信息":
                    id = "3.3";
                    url = "/Message/WorkLogMind.aspx?Type=Prompt";
                    break;
                case "商业店铺":
                    id = "3.4";
                    url = "/Message/BusinessMindGrid.aspx";
                    break;
                case "房屋租赁到期":
                    id = "3.5";
                    url = "/InfoCollection/HouseHoldMindGrid.aspx";
                    break;
                    break;

            }
            if (url != "") {
                updateTab(name, url, "tabs_" + id);
            }
        }

        var now = new Date();
        function maxmap() {
            if (Ext.getCmp("maintree").collapsed) {
                Ext.getCmp("maintree").expand(true);
            } else {
                Ext.getCmp("maintree").collapse(true);
            }
        }
        //alert(now.getTime());
        var policemanName = '<%=GetLoginPoliceName() %>'
        var policemanNumber = '<%=GetLoginPoliceCode() %>';
        //车辆添加列表按钮是否可用
        var btnCarEnable = true;
        //一级管理员
        var AdminI = '<%=GetAdminI() %>';
        //二级管理员
        var AdminII = '<%=GetAdminII() %>';
        //普通用户
        var AdminIII = '<%=GetAdminIII() %>';
        var Disabled = true;
        if (AdminI == "True")
            Disabled = false;
        var tabs = new Ext.TabPanel({
            margins: '5 5 5 0',
            region: 'center',
            enableTabScroll: true,
            defaults: {
                closable: true,

                loadMask: {
                    msg: '正在加载页面，请稍候...'
                },
                autoShow: true
            },
            activeTab: 0,
            items: [{
                title: '我的桌面',
                contentEl: 'center',
                closable: false,
                autoLoad: { url: 'Main.aspx', scripts: true },
                autoScroll: true,
                iconCls: 'new_tab'
            }]
        });

        //增加tabs
        function addTab(tabTitle, tabHtml, tabId, cls, mask) {
            if (mask) {
                tabs.add({
                    title: tabTitle,
                    iconCls: cls,
                    html: '<iframe src="' + tabHtml + '?width=' + tabs.getInnerWidth() + '&height=' + tabs.getInnerHeight() + '" frameborder=no height=100% width=100% noresize></iframe>',
                    autoDestroy: true,
                    id: tabId
                }).show();
            }
            else {
                tabs.add({
                    title: tabTitle,
                    iconCls: cls,
                    autoLoad: { url: tabHtml, scripts: true, params: 'height=' + tabs.getInnerHeight() },
                    autoDestroy: true,
                    autoScroll: true,
                    id: tabId
                }).show();
            }
        };

        //更新tabs
        function updateTab(tabTitle, tabHtml, tabId, cls, mask) {

            var tab = tabs.getItem(tabId);

            if (tab) {
                //TODO:更新tab
                tab.setTitle(tabTitle);
            }
            else {
                tab = addTab(tabTitle, tabHtml, tabId, cls, mask);
            }
            tabs.setActiveTab(tab);
        };
        Ext.onReady(function () {
            Ext.QuickTips.init();


            // Apply a set of config properties to the singleton
            Ext.apply(Ext.QuickTips.getQuickTip(), {
                maxWidth: 200,
                minWidth: 100,
                showDelay: 50,
                trackMouse: true
            });
            //布局
            var border = new Ext.Viewport({
                title: 'Border Layout',
                layout: 'border',
                items: [{
                    collapsible: false,
                    region: 'north',
                    contentEl: 'north',
                    border: false,
                    height: 90
                }, {
                    title: '主菜单',
                    id: 'maintree',
                    region: 'west',
                    frame: true,
                    contentEl: 'west',
                    margins: '5 0 5 5',
                    collapsible: true,
                    split: true,
                    width: 190,
                    minSize: 100,
                    maxSize: 300
                }, tabs]
            });
            //菜单树
            var createXMLTree = function (el, url, callback) {
                var tree = new Ext.tree.TreePanel({
                    el: el,
                    border: false,
                    autoScroll: true,
                    animate: true,
                    collapsed: false
                });
                var p = new Ext.data.HttpProxy({ url: url });
                p.on("loadexception", function (t, o, response, e) {
                    if (e) throw e;
                    Ext.Msg.alert('错误信息', 'xml数据读取错误！' + e.text);
                });
                p.load(null, {
                    read: function (response) {
                        var doc = response.responseXML;
                        var root = nodeFromXML(doc.documentElement || doc);
                        tree.setRootNode(root);
                        tree.render();
                        Ext.tree.Loaded = true;
                    }
                }, callback || tree.expand, tree);
                return tree;
            }


            var nodeFromXML = function (el) {
                if (el.tagName != 'node') return;
                var node = new Ext.tree.TreeNode({
                    id: el.attributes[0].nodeValue
                });

                Ext.each(el.childNodes, function (elt) {
                    if (elt.nodeType != 1) return;
                    if (!elt.firstChild) return;
                    switch (elt.nodeName) {
                        case 'text':
                            node.setText(elt.firstChild.nodeValue);
                            break;
                        case 'url':
                            node.attributes.url = elt.firstChild.nodeValue;
                            break;
                        case 'module':
                            node.attributes.module = elt.firstChild.nodeValue;
                            break;
                        case 'iconCls':
                            node.attributes.iconCls = elt.firstChild.nodeValue;
                        case 'width':
                            node.attributes.width = elt.firstChild.nodeValue;
                            break;
                        case 'height':
                            node.attributes.height = elt.firstChild.nodeValue;
                            break;
                        case 'expanded':
                            if (elt.firstChild.nodeValue == 'true') {
                                node.expanded = true;
                            }
                            break;
                        case 'mark':
                            node.attributes.mark = elt.firstChild.nodeValue;
                            break;
                        case 'children':
                            Ext.each(elt.childNodes, function (elem) {
                                if (elem.nodeType != 1) return;
                                n = nodeFromXML(elem);
                                node.appendChild(n);
                            });
                            break;
                    }
                });
                return node;
            }
            var tree = createXMLTree('tree', 'MenuData.xml', null);


            var win = new Ext.Window({
                width: 350,
                iconCls: 'new_tab',
                height: 400,
                closeAction: 'hide',
                modal: true,
                plain: true
            });
            //单击菜单节点
            tree.on("click", function (node, event) {
                if (node.attributes.module == null) {
                    node.attributes.module = 'tabs';
                }
                if (node.attributes.module == 'window') {
                    win.title = node.text;
                    if (node.attributes.width != null) {
                        win.width = eval(node.attributes.width);
                    }
                    if (node.attributes.height != null) {
                        win.height = eval(node.attributes.height);
                    }
                    win.autoLoad = {
                        url: "'" + node.attributes.url + "'",
                        scripts: true
                    };
                    win.show(this);
                } else if (node.attributes.module == 'iframe') {
                    if (node.attributes.url != null && node.attributes.url != '') {
                        //alert(node.attributes.mark);
                        if (node.attributes.mark != null && node.attributes.mark != '') {
                            if (!eval(node.attributes.mark)) {
                                updateTab(node.text, node.attributes.url, 'tabs_' + node.id, null, true);
                            }
                        }
                        else {
                            Ext.getCmp("maintree").collapse(true);
                            updateTab(node.text, node.attributes.url, 'tabs_' + node.id, null, true);
                        }
                    }
                } else {
                    if (node.attributes.url != null && node.attributes.url != '') {
                        updateTab(node.text, node.attributes.url, 'tabs_' + node.id);
                    }
                }
            }
	    );
        });

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="north" class="x-layout-inactive-content" style="width: 100%; height: 90px;
        background-image: url(images/b3.gif)">
        <img alt="img" src="images/banner_01.gif" height="55" width="259" />
        <div style="position: absolute; font-size: 12px; color: #ffffff; top: 19px; right: 19px">
            登录人：
            <asp:Label ID="loguser" runat="server" />
            | <a id="updatapassword" style="text-decoration: none; font-size: 12px; color: #ffffff;
                cursor: pointer" onclick="AddPsFormClick()">修改密码</a> | <a id="1Numpwd" style="text-decoration: none;
                    font-size: 12px; color: #ffffff; cursor: pointer" onclick="Add1NumpwdClick()">设置1号工程密码</a>
            |
            <asp:LinkButton ID="logout" ForeColor="#ffffff" runat="server" Text="注销" Style="text-decoration: none" />
        </div>
        <div style="position: absolute; background-color: #eeeeee; font-size: 10px; color: black;
            height: 35px; top: 55px; left: 0px; width: 100%;">
            <br />
            <label style="font-size: 16px;">
                &nbsp;&nbsp;&nbsp;当前责任区警务情况：刑事案件：</label>
            <label id="securityCount" class="lableCss" runat="server" onclick="javascript:countNav('刑事案件');">
            </label>
            <label style="font-size: 16px;">
                &nbsp;&nbsp;治安案件：</label>
            <label id="criminalCount" class="lableCss" runat="server" onclick="javascript:countNav('治安案件');" />
            <label style="font-size: 16px;">
                &nbsp;&nbsp;提示信息：</label>
            <label id="promptCount" class="lableCss" runat="server" onclick="javascript:countNav('提示信息');" />
            <label style="font-size: 16px;">
                &nbsp;&nbsp;住户租赁到期：</label>
           <%-- <label id="businessCount" class="lableCss" runat="server" onclick="javascript:countNav('商业店铺');" />
            <label style="font-size: 16px;">
                &nbsp;</label>--%>
            <label id="houseHoldCount" class="lableCss" runat="server" onclick="javascript:countNav('房屋租赁到期');" />
            <br />
        </div>
    </div>
    <!-- West Region -->
    <div id="west" class="x-layout-inactive-content">
        <div id="tree" style="width: 200px; height: 500px;">
        </div>
    </div>
    <!-- Center Region -->
    <div id="center" class="x-layout-inactive-content">
        <!-- Product Grid -->
        <div id="product-grid-panel">
            <div id="product-grid" style="height: 500px;">
            </div>
        </div>
    </div>
    <!-- Product Details Dialog -->
    <div id="product-edit-dialog" style="visibility: hidden;">
        <div class="x-dlg-hd">
            Product Details</div>
        <div class="x-dlg-bd">
            <div id="product-edit-layout" class="x-layout-inactive-content">
                <div id="product-edit-form">
                </div>
            </div>
        </div>
    </div>
    <!-- Product Categories Dialog -->
    <div id="category-dialog" style="visibility: hidden;">
        <div class="x-dlg-hd">
            Product Categories</div>
        <div class="x-dlg-bd">
            <div id="category-center" class="x-layout-inactive-content" style="padding: 10px;">
                <!-- Category Grid -->
                <div id="category-grid-panel">
                    <div id="category-grid">
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- Category Details Dialog -->
    <div id="category-edit-dialog" style="visibility: hidden;">
        <div class="x-dlg-hd">
            Category Details</div>
        <div class="x-dlg-bd">
            <div id="category-edit-layout" class="x-layout-inactive-content">
                <div id="category-edit-form">
                </div>
            </div>
        </div>
    </div>
    <!-- Product Suppliers Dialog -->
    <div id="supplier-dialog" style="visibility: hidden;">
        <div class="x-dlg-hd">
            Product Suppliers</div>
        <div class="x-dlg-bd">
            <div id="supplier-center" class="x-layout-inactive-content" style="padding: 10px;">
                <!-- Supplier Grid -->
                <div id="supplier-grid-panel">
                    <div id="supplier-grid">
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- Supplier Details Dialog -->
    <div id="supplier-edit-dialog" style="visibility: hidden;">
        <div class="x-dlg-hd">
            Supplier Details</div>
        <div class="x-dlg-bd">
            <div id="supplier-edit-layout" class="x-layout-inactive-content">
                <div id="supplier-edit-form">
                </div>
            </div>
        </div>
    </div>
</asp:Content>
